package com.yk.framework.web.service;

import com.yk.common.core.domain.entity.SysUser;
import com.yk.common.utils.ShiroUtils;
import com.yk.course.domain.CourseInfo;
import com.yk.course.domain.CourseType;
import com.yk.course.service.ICourseInfoService;
import com.yk.course.service.ICourseTypeService;
import com.yk.system.domain.SysChild;
import com.yk.system.service.ISysChildService;
import com.yk.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 课程分类Service接口
 * 
 * @author xufei
 * @date 2025-04-28
 */
@Service("otherType")
public class OtherTypeService
{

    @Autowired
    private ICourseTypeService courseTypeService;
    @Autowired
    private ICourseInfoService courseInfoService;
    @Autowired
    private ISysUserService userService;
    @Autowired
    private ISysChildService childService;

    /**
     * 获取课程分类
     * @return
     */
    public List<CourseType> getCourseType()
    {
        CourseType courseType = new CourseType();
        return courseTypeService.selectCourseTypeList(courseType);
    }

    /**
     * 获取课程信息
     * status=0 查询所有
     * @return
     */
    public List<CourseInfo> getCourseInfoList(String status)
    {
        CourseInfo courseInfo = new CourseInfo();
        if ("0".equals(status)) courseInfo.setCourseStatus(status);
        return courseInfoService.selectCourseInfoList(courseInfo);
    }

    /**
     * 获取教师列表
     * @return
     */
    public List<SysUser> selectTeacherList() {
        return userService.selectTeacherList();
    }

    /**
     * 获取家长用户id
     * @return
     */
    public List<SysUser> selectParentList() {
        return userService.selectParentList();
    }


    /**
     * 获取用户孩子信息
     * @return
     */
    public List<SysChild> selectChildList() {
        SysChild sysChild = new SysChild();
        sysChild.setParentId(ShiroUtils.getUserId());
        return childService.selectSysChildList(sysChild);
    }

    /**
     * 获取所有孩子信息
     * @return
     */
    public List<SysChild> selectAllChildList() {
        SysChild sysChild = new SysChild();
        return childService.selectSysChildList(sysChild);
    }


    /**
     * 获取家长对应孩子信息
     * @param parentId
     * @return
     */
    public List<SysChild> selectChildListByParentId(Long parentId) {
        SysChild sysChild = new SysChild();
        if (parentId != null) sysChild.setParentId(parentId);
        return childService.selectSysChildList(sysChild);
    }
}
